/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ManagersUI;

import ControladoresUI.JornadasInicioController;
import Entidades.Jornada;
import java.io.IOException;
import java.util.logging.*;
import javafx.fxml.FXMLLoader;
import javafx.scene.*;
import Entidades.Usuario;
import javafx.scene.layout.StackPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

/**
 *
 * @author JEscalante
 */
public class JornadasInicioManager {
    private Scene scene;
    private Stage stage;
    public Parent root;
    public AjustesManager ajustesManager;
    public JornadasInicioManager(Scene scene, Stage stage, AjustesManager ajustesManager) {
        this.scene = scene;
        this.stage = stage;
        this.ajustesManager = ajustesManager;
    }
  /*  public void abrirPanelUsuarios(Usuario usuario){
        try {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("/VistasUI/pnlUsuarios.fxml"));
            scene.setRoot((Parent) loader.load());
            UsuariosController controller = loader.<UsuariosController>getController();
            controller.initManager(this, usuario);
        } catch (IOException ex) {
            Logger.getLogger(UsuariosManager.class.getName()).log(Level.SEVERE, null, ex);
        }
    }*/
    public void abrirPanelJornadasInicio(Usuario usuario){
        try {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("/VistasUI/pnlJornadasInicio.fxml"));
            root = (Parent) loader.load();
            JornadasInicioController controller = loader.<JornadasInicioController>getController();
            controller.initManager(this, usuario);
        } catch (IOException ex) {
            Logger.getLogger(JornadasInicioManager.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public void showPnlJornadasRegistro(){
        scene = new Scene(new StackPane());
        Stage nuevaStage = new Stage();
        nuevaStage.initStyle(StageStyle.UTILITY);
        nuevaStage.initModality(Modality.APPLICATION_MODAL);
        JornadasRegistroManager jornadasRegistroManager = new JornadasRegistroManager(scene,nuevaStage);
        jornadasRegistroManager.showCarrerasRegistro(this.ajustesManager);

        nuevaStage.setScene(scene);
        nuevaStage.setTitle("Registro de jornadas");
        nuevaStage.show();
    }
    public void showPnlJornadasModificar(Jornada registro){
        scene = new Scene(new StackPane());
        Stage nuevaStage = new Stage();
        nuevaStage.initStyle(StageStyle.UTILITY);
        nuevaStage.initModality(Modality.APPLICATION_MODAL);
        JornadasModificarManager jornadasModificarManager = new JornadasModificarManager(scene,nuevaStage);
        jornadasModificarManager.showJornadasModificar(registro,this.ajustesManager);

        nuevaStage.setScene(scene);
        nuevaStage.setTitle("Modificación de jornadas");
        nuevaStage.show();
    }
    

}
